package com.woniu.atms.mapper;
import com.woniu.atms.entity.G5CarType;
import org.apache.ibatis.annotations.*;

import java.util.List;


/**
  *@author LHY
  *@createTime 2022/1/18/11:25
 **/
public interface CarTypeMapper {

    /**
     * 根据id查询车辆类型
     * @param id
     * @return
     */
    @Select("SELECT * FROM g5_car_type WHERE is_exit='y' AND id=#{id} ")
    public G5CarType findCarTypeById(int id);

    /**
     * 查询所有车辆类型
     * @return
     */
    @Select("SELECT * FROM g5_car_type WHERE is_exit='y' ")
    public List<G5CarType> findAllCarType();

    /**
     * 添加车辆类型
     * @param carType
     * @return
     */
    @Insert("INSERT INTO g5_car_type(name,seat_num,is_exit) VALUES(#{name},#{seatNum},#{isExit})")
    public boolean addCarType(G5CarType carType);

    /**
     * 删除车辆类型
     * @param id
     * @return
     */
    @Update("UPDATE g5_car_type SET is_exit='n' WHERE id=#{id}")
    public boolean deleteCarType(int id);

    /**
     * 根据类型名查询
     * @param name
     * @return
     */
    @Select("SELECT * FROM g5_car_type WHERE name=#{name}")
    public G5CarType findCarTypeByName(String name);
}
